
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="guide">
	<tr>
		<td>
			<span style="float: left;">后台管理中心&nbsp;&raquo;&nbsp;日志管理</span>
			<span style="float: right;">
				<a href="javascript:history.go(-1);">&lt;- 返回</a>
			</span>
		</td>
	</tr>
</table>

<div align="center" style="margin-bottom: 8px;">
	<form action="./?controller=log" method="POST">
	用户
	<select name="userid">
		<option value="0">不限</option>
<?php
foreach ($this->userData as $userRow)
{
	$userid		= $userRow['id'];
	$displayName= $userRow['username'].($userRow['realname'] ? ' ('.$userRow['realname'].')' : null);
	$selected	= $userid == $this->params['userid'] ? ' selected' : null;
	
	echo <<<EOF
		<option value="$userid"$selected>$displayName</option>
EOF;
}
?>
	</select>
	&nbsp;&nbsp;
	消息
	<input class="input" name="message" value="<?=$this->params['message']?>" maxlength=32 />
	&nbsp;&nbsp;
	<input type="submit" value="查询">
	</form>
</div>

<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableborder">
	<tr class="header">
		<td colspan="11">日志列表</td>
	</tr>
	<tr class="category" align="center">
		<td width="10%">ID</td>
		<td width="15%">用户</td>
		<td width="45%">消息</td>
		<td width="20%">时间</td>
		<td width="10%">操作</td>
	</tr>
<?php
$i = 0;

foreach ($this->data as $row)
{
	$id			= $row['id'];
	$userid		= $row['userid'];
	$userRow	= $this->userTable->getRow($userid);
	$username	= $userRow['username'];
	$realname	= $userRow['realname'];
	$displayName= $username.($realname ? ' ('.$realname.')' : null);
	$message	= nl2br($row['message']);
	$time		= date('Y-m-d H:i:s', $row['time']);
	
	echo <<<EOF
	<tr>
		<td class="altbg1" align="center">$id</td>
		<td class="altbg2" align="center">
			<a href="./?controller=user&id=$userid">$displayName</a>
		</td>
		<td class="altbg1">$message</td>
		<td class="altbg2" align="center">$time</td>
		<td class="altbg1" align="center">
			<a href="javascript:confirmDelete('./?controller=log&action=delete&id=$id')">删除</a>
		</td>
	</tr>
EOF;
}
?>
	<tr class="category">
		<td align="center" colspan="5">
			<?=$this->paging?>
		</td>
	</tr>
</table>
